package com.xtsoft.platform.task.domain;

import java.util.Date;
import java.util.List;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.xtsoft.core.entity.GenericEntity;

import lombok.Data;

@Entity
@Table(name = "task_bug")
@Data
public class TaskBugTwo extends GenericEntity{
	@Id
	@GeneratedValue(generator = "system-uuid")
	@GenericGenerator(name = "system-uuid", strategy = "uuid")
	@Column(name = "taskBugId", nullable = false, length = 32)
	private String taskBugId;
	
	@ManyToOne
	@JoinColumn(name="infTaskId")
	@JsonIgnore
	private InfTask infTask;
	
	@JsonFormat(pattern = "yyyy-MM-dd",timezone="GMT+8")
	@Column(name = "reportDate",length=19,nullable=false)
	private Date reportDate;
	
	
	/**
	 * 0、已发现 1、已解决 2、已确定 3、已关闭
	 */
	@Column(name = "state",nullable=false,length=10)
	private Integer state;
	
	@Column(name = "updateTime",nullable=false,length = 19)
	private long updateTime;
	
	@Column(name = "descript",nullable = true, length=255)
	private String descript;
	
	/**
	 * 0、轻微  1、一般  2、严重
	 */
	@Column(name = "bugLevel",nullable=false,length=10)
	private Integer bugLevel;
	/**
	 * 以实体类主键生成HASHCODE
	 */
	@Override
	public int hashCode() {
		return this.taskBugId.hashCode();
	}
	/**
	 * 以实体类主键比较对象是否相等
	 */
	@Override
	public boolean equals(Object obj) {
		if (obj instanceof com.xtsoft.platform.task.domain.TaskBug) {
			return this.taskBugId.equals(((TaskBug) obj).getTaskBugId());
		}
		return false;
	}
	@Override
	public String toString() {
		return "TaskBug [taskBugId=" + taskBugId + ", infTask=" + infTask + ", reportDate=" + reportDate
				 + ", state=" + state + ", updateTime=" + updateTime + ", descript="
				+ descript + "]";
	}
	
}
